package com.demo.listview.jquery;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class ListViewJQueryDemoActivity extends Activity {
  
	private WebView webview;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		webview = (WebView) findViewById(R.id.webview);
		webview.setWebViewClient(new DemoClient());
		webview.addJavascriptInterface(new JavaScriptInterface(this), "Android");
		webview.getSettings().setJavaScriptEnabled(true);
		webview.getSettings().setDomStorageEnabled(true);
		webview.loadUrl("file:///android_asset/www/pepe.html");
	}

	private class DemoClient extends WebViewClient {

		@Override
		public boolean shouldOverrideUrlLoading(WebView view, String url) {
			view.loadUrl("javascript:changeLocation('" + url + "')");
			return true;
		}
	}
}